package cn.serenedream.housedecoration.controller;

import cn.serenedream.housedecoration.serivce.SaleService;
import cn.serenedream.housedecoration.serivce.UserService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {
    @Autowired
    UserService userService;

    @Autowired
    SaleService saleService;

    @GetMapping("")
    public String index(Model model,
                        HttpServletRequest httpServletRequest) {
        model.addAttribute("userCount", userService.count());
        model.addAttribute("saleCount", saleService.count());
        model.addAttribute("requestURI", httpServletRequest.getRequestURI());
        System.out.println(httpServletRequest.getRequestURI());
        return "classify/index";
    }
}
